package com.example.myerp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.myerp.pojo.S_cell;
import com.example.myerp.mapper.S_cellMapper;
import com.example.myerp.pojo.S_cellAsion;
import com.example.myerp.service.S_cellService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.myerp.until.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhuxingyu
 * @since 2021-08-10
 */
@SuppressWarnings("all")
@Service
public class S_cellServiceImpl extends ServiceImpl<S_cellMapper, S_cell> implements S_cellService {

    @Autowired
    S_cellMapper s_cellMapper;
    @Autowired
    RedisUtil redisUtil;

    @Override
    public List<S_cell> confighouse(Integer firstKindId, Integer secondKindId, Integer thirdKindId) {
        return s_cellMapper.confighouse(firstKindId, secondKindId, thirdKindId);
    }

    @Override
    public void insertS_cell(S_cell s_cell) {
        s_cellMapper.insertS_cell(s_cell);
    }

    @Override
    public IPage<S_cellAsion> searchNoCheck(Long pageNum, Long pageSize) {
        Page<S_cellAsion> page = new Page<>(pageNum, pageSize, true);
        //S_cellServiceImpl.searchNoCheck
        IPage<S_cellAsion> pageTwo = null;
//        if(redisUtil.hasKey("S_cellServiceImpl.searchNoCheck")){
//            pageTwo= (IPage<S_cellAsion>) redisUtil.get("S_cellServiceImpl.searchNoCheck");
//        }else{
//            pageTwo = s_cellMapper.searchNoCheck(page);
//            redisUtil.set("S_cellServiceImpl.searchNoCheck",pageTwo);
//        }
        pageTwo = s_cellMapper.searchNoCheck(page);
        return pageTwo;
    }

    @Override
    public void shS_cell(S_cell s_cell) {
        s_cellMapper.shS_cell(s_cell);
    }

    @Override
    public Integer check_Scell_Config(Integer productId) {
        return s_cellMapper.check_Scell_Config(productId);
    }

    @Override
    public IPage<S_cellAsion> onLineList(Long pageNum, Long pageSize) {
        Page<S_cellAsion> page = new Page<S_cellAsion>(pageNum, pageSize);
        return s_cellMapper.onLineList(page);
    }
}
